﻿using System;
using MugenInjection.Interface;
using MugenInjection.Interface.Components;
using MugenInjection.Logging.Components;
using MugenInjection.Logging.Infrastructure;
using MugenInjection.Logging.NLog2.Infrastructure;

namespace MugenInjection.Logging.NLog2.Components
{
    public class NLogFactoryComponent : LoggerFactoryComponent
    {
        #region Overrides of Component

        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public override IComponent Clone()
        {
            return new NLogFactoryComponent();
        }

        #endregion

        #region Overrides of LoggerFactoryComponent

        /// <summary>
        /// Gets the logger for the specified type, creating it if necessary.
        /// </summary>
        /// <param name="type">The type to create the logger for.</param>
        /// <returns>The newly-created logger.</returns>
        protected override LoggerBase GetLoggerInternal(Type type)
        {
            return new NLogLogger(this, type);
        }

        #endregion
    }
}